//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class CEntityIdTranslator {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CEntityIdTranslator(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CEntityIdTranslator obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CEntityIdTranslator(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static CEntityIdTranslator getInstance() {
    long cPtr = nelmiscJNI.CEntityIdTranslator_getInstance();
    return (cPtr == 0) ? null : new CEntityIdTranslator(cPtr, false);
  }

  public void clear() {
    nelmiscJNI.CEntityIdTranslator_clear(swigCPtr, this);
  }

  public boolean checkEntityName(ucstring entityName) {
    return nelmiscJNI.CEntityIdTranslator_checkEntityName(swigCPtr, this, ucstring.getCPtr(entityName), entityName);
  }

  public boolean entityNameExists(ucstring entityName) {
    return nelmiscJNI.CEntityIdTranslator_entityNameExists(swigCPtr, this, ucstring.getCPtr(entityName), entityName);
  }

  public void registerEntity(CEntityId eid, ucstring entityName, char entitySlot, long uid, String userName, long shardId) {
    nelmiscJNI.CEntityIdTranslator_registerEntity__SWIG_0(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, entitySlot, uid, userName, shardId);
  }

  public void registerEntity(CEntityId eid, ucstring entityName, char entitySlot, long uid, String userName) {
    nelmiscJNI.CEntityIdTranslator_registerEntity__SWIG_1(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, entitySlot, uid, userName);
  }

  public void updateEntity(CEntityId eid, ucstring entityName, char entitySlot, long uid, String userName, long shardId) {
    nelmiscJNI.CEntityIdTranslator_updateEntity__SWIG_0(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, entitySlot, uid, userName, shardId);
  }

  public void updateEntity(CEntityId eid, ucstring entityName, char entitySlot, long uid, String userName) {
    nelmiscJNI.CEntityIdTranslator_updateEntity__SWIG_1(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, entitySlot, uid, userName);
  }

  public void unregisterEntity(CEntityId eid) {
    nelmiscJNI.CEntityIdTranslator_unregisterEntity(swigCPtr, this, CEntityId.getCPtr(eid), eid);
  }

  public boolean isEntityRegistered(CEntityId eid) {
    return nelmiscJNI.CEntityIdTranslator_isEntityRegistered(swigCPtr, this, CEntityId.getCPtr(eid), eid);
  }

  public boolean setEntityNameStringId(ucstring entityName, long stringId) {
    return nelmiscJNI.CEntityIdTranslator_setEntityNameStringId__SWIG_0(swigCPtr, this, ucstring.getCPtr(entityName), entityName, stringId);
  }

  public boolean setEntityNameStringId(CEntityId eid, long stringId) {
    return nelmiscJNI.CEntityIdTranslator_setEntityNameStringId__SWIG_1(swigCPtr, this, CEntityId.getCPtr(eid), eid, stringId);
  }

  public long getEntityNameStringId(CEntityId eid) {
    return nelmiscJNI.CEntityIdTranslator_getEntityNameStringId(swigCPtr, this, CEntityId.getCPtr(eid), eid);
  }

  public long getEntityShardId(CEntityId eid) {
    return nelmiscJNI.CEntityIdTranslator_getEntityShardId(swigCPtr, this, CEntityId.getCPtr(eid), eid);
  }

  public void setEntityOnline(CEntityId eid, boolean online) {
    nelmiscJNI.CEntityIdTranslator_setEntityOnline(swigCPtr, this, CEntityId.getCPtr(eid), eid, online);
  }

  public boolean isEntityOnline(CEntityId eid) {
    return nelmiscJNI.CEntityIdTranslator_isEntityOnline(swigCPtr, this, CEntityId.getCPtr(eid), eid);
  }

  public void checkEntity(CEntityId eid, ucstring entityName, long uid, String userName) {
    nelmiscJNI.CEntityIdTranslator_checkEntity(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, uid, userName);
  }

  public void load(String fileName, String invalidEntityNamesFilename) {
    nelmiscJNI.CEntityIdTranslator_load(swigCPtr, this, fileName, invalidEntityNamesFilename);
  }

  public void save() {
    nelmiscJNI.CEntityIdTranslator_save(swigCPtr, this);
  }

  public CEntityId getByEntity(ucstring entityName) {
    return new CEntityId(nelmiscJNI.CEntityIdTranslator_getByEntity__SWIG_0(swigCPtr, this, ucstring.getCPtr(entityName), entityName), true);
  }

  public ucstring getByEntity(CEntityId eid) {
    return new ucstring(nelmiscJNI.CEntityIdTranslator_getByEntity__SWIG_1(swigCPtr, this, CEntityId.getCPtr(eid), eid), false);
  }

  public void getEntityIdInfo(CEntityId eid, ucstring entityName, SWIGTYPE_p_char entitySlot, SWIGTYPE_p_unsigned_int uid, SWIGTYPE_p_std__string userName, SWIGTYPE_p_bool online, SWIGTYPE_p_std__string additional) {
    nelmiscJNI.CEntityIdTranslator_getEntityIdInfo__SWIG_0(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, SWIGTYPE_p_char.getCPtr(entitySlot), SWIGTYPE_p_unsigned_int.getCPtr(uid), SWIGTYPE_p_std__string.getCPtr(userName), SWIGTYPE_p_bool.getCPtr(online), SWIGTYPE_p_std__string.getCPtr(additional));
  }

  public void getEntityIdInfo(CEntityId eid, ucstring entityName, SWIGTYPE_p_char entitySlot, SWIGTYPE_p_unsigned_int uid, SWIGTYPE_p_std__string userName, SWIGTYPE_p_bool online) {
    nelmiscJNI.CEntityIdTranslator_getEntityIdInfo__SWIG_1(swigCPtr, this, CEntityId.getCPtr(eid), eid, ucstring.getCPtr(entityName), entityName, SWIGTYPE_p_char.getCPtr(entitySlot), SWIGTYPE_p_unsigned_int.getCPtr(uid), SWIGTYPE_p_std__string.getCPtr(userName), SWIGTYPE_p_bool.getCPtr(online));
  }

  public String getRegisterableString(ucstring entityName) {
    return nelmiscJNI.CEntityIdTranslator_getRegisterableString(swigCPtr, this, ucstring.getCPtr(entityName), entityName);
  }

  public Vector_String getInvalidNames() {
    return new Vector_String(nelmiscJNI.CEntityIdTranslator_getInvalidNames(swigCPtr, this), false);
  }

  public SWIGTYPE_p_std__mapT_NLMISC__CEntityId_NLMISC__CEntity_t getRegisteredEntities() {
    return new SWIGTYPE_p_std__mapT_NLMISC__CEntityId_NLMISC__CEntity_t(nelmiscJNI.CEntityIdTranslator_getRegisteredEntities(swigCPtr, this), false);
  }

  public static long getVersion() {
    return nelmiscJNI.CEntityIdTranslator_Version_get();
  }

  public void setFileVersion(long value) {
    nelmiscJNI.CEntityIdTranslator_FileVersion_set(swigCPtr, this, value);
  }

  public long getFileVersion() {
    return nelmiscJNI.CEntityIdTranslator_FileVersion_get(swigCPtr, this);
  }

  public void setEntityInfoCallback(SWIGTYPE_p_f_r_q_const__CEntityId__std__string value) {
    nelmiscJNI.CEntityIdTranslator_EntityInfoCallback_set(swigCPtr, this, SWIGTYPE_p_f_r_q_const__CEntityId__std__string.getCPtr(value));
  }

  public SWIGTYPE_p_f_r_q_const__CEntityId__std__string getEntityInfoCallback() {
    long cPtr = nelmiscJNI.CEntityIdTranslator_EntityInfoCallback_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_f_r_q_const__CEntityId__std__string(cPtr, false);
  }

}
